import request from '@/utils/request'

export const getRoleListAPI = (params) => {
  return request({
    url: '/sys/role',
    params
  })
}

// 新增角色
export const addRoleAPI = (data) => {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

// 删除角色
export const delRoleAPI = (id) => {
  return request({
    url: '/sys/role/' + id,
    method: 'delete'
  })
}

// 编辑角色
export const editRoleAPI = (data) => {
  return request({
    url: '/sys/role/' + data.id,
    method: 'put',
    data
  })
}

// 给用户添加角色
export const assignRoleAPI = (data) => {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}

// 角色详情
export const permDetailAPI = (id) => {
  return request('/sys/role/' + id)
}

//
export const assignPermAPI = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
